/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
* @website https://el-admin.vip
* @description /
* @author LongYang
* @date 2021-06-28
**/
@Entity
@Data
@Table(name="kw_exam_teacher")
@EntityListeners(AuditingEntityListener.class)
public class KwExamTeacher implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "系统主键")
    private Integer id;

    @Column(name = "exam_room_id")
    @ApiModelProperty(value = "考场id")
    private Integer examRoomId;

    @Column(name = "job_number")
    @ApiModelProperty(value = "教师工号")
    private String jobNumber;

    @Column(name = "name_cn")
    @ApiModelProperty(value = "姓名")
    private String nameCn;

    @Column(name = "id_card")
    @ApiModelProperty(value = "身份证")
    private String idCard;

    @Column(name = "alias")
    @ApiModelProperty(value = "标识")
    private String alias;

    @Column(name = "teacher_id")
    @ApiModelProperty(value = "教师id")
    private Integer teacherId;

    @Column(name = "dept_id")
    @ApiModelProperty(value = "部门id")
    private Integer deptId;

    @Transient
    @ApiModelProperty(value = "部门名")
    private String deptName;

    @Column(name = "type")
    @ApiModelProperty(value = "监考教师类型（0：上报，1：报名）")
    private String type;

    @Column(name = "del_flag")
    @ApiModelProperty(value = "删除标识（0：未删除，1：已删除）")
    private String delFlag;

    @Column(name = "phone")
    @ApiModelProperty(value = "手机号")
    private String phone;

    @Column(name = "exam_id")
    @ApiModelProperty(value = "考试Id")
    private Integer examId;

    @Column(name = "room_id")
    @ApiModelProperty(value = "教室id")
    private Integer roomId;

    @Column(name = "identity")
    @ApiModelProperty(value = "老师身份类型（0代表监考老师，1代表考务人员,2代表特殊人员）")
    private String identity="0";

    @Column(name = "checkin_status",columnDefinition = "char(1) COMMENT '签到状态(0代表未签到，1代表已签到)'")
    @ApiModelProperty(value = "签到状态(0代表未签到，1代表已签到)")
    private String checkinStatus;

    @Column(name = "checkin_time",columnDefinition = "datetime COMMENT '签到时间'")
    @ApiModelProperty(value = "签到时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String checkinTime;

    @Column(name = "create_time",columnDefinition = "datetime COMMENT '创建时间'")
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @CreatedDate
    private Date createTime;

    @Column(name = "update_time",columnDefinition = "datetime COMMENT '修改时间'")
    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @CreatedDate
    @LastModifiedDate
    private Date updateTime;

    @ApiModelProperty("替补老师")
    @Column(name = "replaceTeacherId",columnDefinition = "int COMMENT '替补老师' ")
    private Integer replaceTeacherId;

    @ApiModelProperty(value = "性别")
    @Column(name = "sex",columnDefinition = "int COMMENT '性别 0=男,1=女'")
    private Integer sex = 0;


    @ApiModelProperty("保存此条数据的学院id")
    @Column(name = "saveDeptId")
    private Long saveDeptId;

    public void copy(KwExamTeacher source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}